<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
    <title></title>
    <link rel="stylesheet" href="style.css" type="text/css">
    <script src="../../../libs/jquery-1.11.3.js"></script>
</head>

<body>
<h2>特殊选择器this</h2>

<p id="test1">点击测试：通过原生DOM处理</p>

<p id="test2">点击测试：通过原生jQuery处理</p>

<script type="text/javascript">
    //    var p1 = document.getElementById('test1')
    //    p1.addEventListener('click',function(){
    //        //直接通过dom的方法改变颜色
    //        this.style.color = "red";
    //    },false);
    var p1 = document.getElementById("test1");
    p1.addEventListener("click", function () {
        this.style.color = "red";
    }, false);
</script>

<script type="text/javascript">
    $('#test2').click(function () {
        //通过包装成jQuery对象改变颜色
        $(this).css('color', 'blue');
    })
</script>

</body>

</html>